package com.boarsoft.boar.soagov.face.action;

import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

import com.boarsoft.bean.ReplyInfo;
import com.boarsoft.boar.soagov.entity.FaceImpl;
import com.boarsoft.boar.soagov.face.FaceImplBiz;
import com.boarsoft.common.Authorized;
import com.boarsoft.common.dao.PagedResult;

@RestController
@RequestMapping("/face/impl")
public class FaceImplAction {
	@Autowired
	private FaceImplBiz faceImplBiz;

	/**
	 * 查询所有接口
	 */
	@RequestMapping("/list.do")
	@Authorized(code = "face.impl.list")
	public ReplyInfo<Object> list(String faceId, String key, String orderBy, int pageNo, int pageSize) {
		PagedResult<FaceImpl> pr = faceImplBiz.list(faceId, key, orderBy, pageNo, pageSize);
		return new ReplyInfo<Object>(true, pr);
	}

	@RequestMapping("/save.do")
	@Authorized(code = "face.impl.save")
	public ReplyInfo<Object> save(FaceImpl fa) {
		faceImplBiz.save(fa);
		return ReplyInfo.SUCCESS;
	}

	@RequestMapping("/delete.do")
	@Authorized(code = "face.impl.delete")
	public ReplyInfo<Object> delete(String id) {
		faceImplBiz.delete(id);
		return ReplyInfo.SUCCESS;
	}

	@RequestMapping("/get.do")
	@Authorized(code = "face.impl.get")
	public ReplyInfo<Object> get(String id) {
		FaceImpl a = faceImplBiz.get(id);
		return new ReplyInfo<Object>(true, a);
	}
}